using System;
using System.Collections.Generic;
using UnityEditor.SearchService;
using UnityEngine;
using UnityEngine.Tilemaps;

public static class EventHandler
{

    /// <summary>
    /// 移动事件（玩家或其它物品的移动）
    /// </summary>
    public static event Action<Vector2> MoveEvent;

    public static void CallMoveEvent(Vector2 pos)
    {
        MoveEvent?.Invoke(pos);
    }

    /// <summary>
    /// 停止移动（玩家或其它物品）
    /// </summary>
    public static event Action StopMoveEvent;

    public static void CallStopMoveEvent()
    {
        StopMoveEvent?.Invoke();
    }

    /// <summary>
    /// 修改当前玩家
    /// </summary>
    public static event Action<PlayerDetails> CharacterChanged;

    public static void CallCharacterChanged(PlayerDetails playerDetail)
    {
        CharacterChanged?.Invoke(playerDetail);
    }

    /// <summary>
    /// 路径生成完毕事件
    /// </summary>
    public static event Action FinishFollowingPath;
    public static void CallFinishFollowingPath()
    {
        FinishFollowingPath?.Invoke();
    }

    /// <summary>
    /// 路径跟随事件
    /// </summary>
    public static event Action<List<Vector3Int>, Tilemap> StartFollowingPath;
    public static void CallStartFollowingPath(List<Vector3Int> path, Tilemap tilemap)
    {
        StartFollowingPath?.Invoke(path, tilemap);
    }


    /// <summary>
    /// 加载场景之前的事件
    /// </summary>
    public static event Action BeforeSceneUnloadEvent;

    public static void CallBeforeSceneUnloadEvent()
    {
        BeforeSceneUnloadEvent?.Invoke();
    }

    /// <summary>
    /// 场景加载之后事件
    /// </summary>
    public static event Action AfterSceneLoadEvent;
    
    public static void CallAfterSceneLoadEvent()
    {
        AfterSceneLoadEvent?.Invoke();
    }


    /// <summary>
    /// 相机拖动事件
    /// </summary>
    public static event Action<Vector2> CameraDragEvent;

    public static void CallCameraDragEvent(Vector2 delta)
    {
        CameraDragEvent?.Invoke(delta);
    }


    /// <summary>
    /// 相机放大缩小事件
    /// </summary>
    public static event Action<float> CameraZoomEvent;

    public static void CallCameraZoomEvent(float scrollValueY)
    {
        CameraZoomEvent?.Invoke(scrollValueY);
    }


    // 循环完成事件（参数为当前循环次数）Event
    public static event Action<int> LoopCompletedEvent;

    public static void CallLoopCompletedEvent(int loopCount)
    {
        LoopCompletedEvent?.Invoke(loopCount);
    }

    /// <summary>
    /// 游戏开始事件
    /// </summary>
    public static event Action<int> StartNewGameEvent;

    public static void CallStartNewGameEvent(int index)
    {
        StartNewGameEvent?.Invoke(index);
    }

    /// <summary>
    /// 游戏结束事件
    /// </summary>
    public static event Action EndGameEvent;

    public static void CallEndGameEvent()
    {
        EndGameEvent?.Invoke();
    }

    
    
}
